<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
      /* 1.JSON是轻量级的数据交换格式 */
      var json1 = {
          username:"唐三",
          age:100
      };
      console.log("姓名："+ json1.username +",年龄："+ json1.age +"岁");

      //JSON数组
      var jsonarr = [
          {name:"小舞",age: 99},
          {name:"奥斯卡",age: 95}
      ];
      console.log("小舞"+jsonarr[0].age+" 岁了！");
      console.log("奥斯卡"+jsonarr[1].age+" 岁了！");

      //复杂的JSON对象
      var long = {
          name : "戴沐白",
          sex : "男",
          hobby : ["白虎护身罩","白虎烈光波","白虎流星雨","白虎破灭杀"]
      };
      for(var i=0; i<long.hobby.length; i++){
         console.log(long.name +"的魂技技能："+ long.hobby[i]);
      }

    </script>
</body>
</html>